package jhub.text;

import java.text.MessageFormat;
import java.text.ParseException;

import jhub.DCProtocol;

public class QuitMessage extends DCRawCommand {
    
    public static QuitMessage getInstance(String nick) throws ParseException{
        return new QuitMessage(MessageFormat.format(DCProtocol.QUIT_FORMAT,nick));
    }
    
    private String nick;
    
    
    public QuitMessage(String command) throws ParseException {
        super(command);
        parse();
    }
    
    private void parse() throws ParseException{
        Object[] o = new MessageFormat(DCProtocol.QUIT_FORMAT).parse(command.toString());
        nick = o[0].toString();
    }
    
    
    /**
     * @return Returns the nick.
     */
    public String getNick() {
        return nick;
    }
    
}
